﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PaceR.Core.Interfaces.Conditionals;
using PaceR.Core.Interfaces;
using PaceR.Core.Utilities;

namespace PaceR.Core.Conditionals
{
    public class SimpleConditionalFunction<T, TResult> : IConditionalFunction<T, TResult>
    {
        #region IConditionalFunction<T,TResult> Members

        public virtual Func<T, TResult> Function { get; set; }

        public virtual T FunctionArgument { get; set; }

        public virtual TResult FunctionResult { get; set; }

        #endregion IConditionalFunction<T,TResult> Members

        #region IConditionalOperation Members

        public virtual IResultMessages Execute()
        {
            FunctionResult = Function(FunctionArgument);
            return ResultObjectFactoryUtil.Factory.GetResultMessagesObject();
        }

        #endregion IConditionalOperation Members
    }
}
